/**
 ******************************************************************************
 * @file    zb32l03x_hal_usart_irda.h
 * @author  MCU Application Team
 * @Version V0.0.1
 * @Date    2022/12/16
 * @brief   USART IrDA HAL module driver.
 @verbatim
 ******************************************************************************
 **/

#ifndef __ZB32L03x_HAL_USART_IRDA_H
#define __ZB32L03x_HAL_USART_IRDA_H

#include "zb32l03x_hal.h"

#ifdef __cplusplus
extern "C" {
#endif


/** @defgroup  USART IrDA Interrupt Flag with SR Register definition.
  * @{
  */
#define USART_IRDA_FLAG_PE                      ((uint32_t)USART_SR_PE)
#define USART_IRDA_FLAG_FE                      ((uint32_t)USART_SR_FE)
#define USART_IRDA_FLAG_NE                      ((uint32_t)USART_SR_NE)
#define USART_IRDA_FLAG_ORE                     ((uint32_t)USART_SR_ORE)
#define USART_IRDA_FLAG_RXNE                    ((uint32_t)USART_SR_RXNE)
#define USART_IRDA_FLAG_TC                      ((uint32_t)USART_SR_TC)
#define USART_IRDA_FLAG_TXE                     ((uint32_t)USART_SR_TXE)

/** @defgroup  USART IrDA Enable or Disable NVIC Interrupt Flag  definition.
  * @{
  */
#define USART_IRDA_IT_PEIE                      ((uint32_t)(USART_CR1_PEIE))
#define USART_IRDA_IT_TXEIE                     ((uint32_t)(USART_CR1_TXEIE))
#define USART_IRDA_IT_TCIE                      ((uint32_t)(USART_CR1_TCIE))
#define USART_IRDA_IT_RXNEIE                    ((uint32_t)(USART_CR1_RXNEIE))

#define USART_IRDA_IT_MASK                      ((uint32_t)(USART_CR1_PEIE | USART_CR1_TXEIE | USART_CR1_TCIE | USART_CR1_RXNEIE))

/**
 * @brief HAL UART State structures definition
 * @note  HAL UART State value is a combination of 2 different substates: gState and RxState.
 *        - gState contains UART state information related to global Handle management
 *          and also information related to Tx operations.
 *          gState value coding follow below described bitmap :
 *          b7-b6  Error information
 *             00 : No Error
 *             01 : (Not Used)
 *             10 : Timeout
 *             11 : Error
 *          b5     IP initialisation status
 *             0  : Reset (IP not initialized)
 *             1  : Init done (IP initialized. HAL UART Init function already called)
 *          b4-b3  (not used)
 *             xx : Should be set to 00
 *          b2     Intrinsic process state
 *             0  : Ready
 *             1  : Busy (IP busy with some configuration or internal operations)
 *          b1     (not used)
 *             x  : Should be set to 0
 *          b0     Tx state
 *             0  : Ready (no Tx operation ongoing)
 *             1  : Busy (Tx operation ongoing)
 *        - RxState contains information related to Rx operations.
 *          RxState value coding follow below described bitmap :
 *          b7-b6  (not used)
 *             xx : Should be set to 0
 *          b5     IP initialisation status
 *             0  : Reset (IP not initialized)
 *             1  : Init done (IP initialized)
 *          b4-b2  (not used)
 *            xxx : Should be set to 000
 *          b1     Rx state
 *             0  : Ready (no Rx operation ongoing)
 *             1  : Busy (Rx operation ongoing)
 *          b0     (not used)
 *             x  : Should be set to 0.
 */
typedef enum
{
    HAL_USART_IRDA_STATE_RESET              = 0x00U,    /*!< Peripheral is not yet Initialized
                                                            Value is allowed for gState and RxState */
    HAL_USART_IRDA_STATE_READY              = 0x20U,    /*!< Peripheral Initialized and ready for use
                                                            Value is allowed for gState and RxState */
    HAL_USART_IRDA_STATE_BUSY               = 0x24U,    /*!< an internal process is ongoing
                                                            Value is allowed for gState only */
    HAL_USART_IRDA_STATE_BUSY_TX            = 0x21U,    /*!< Data Transmission process is ongoing
                                                            Value is allowed for gState only */
    HAL_USART_IRDA_STATE_BUSY_RX            = 0x22U,    /*!< Data Reception process is ongoing
                                                            Value is allowed for RxState only */
    HAL_USART_IRDA_STATE_TIMEOUT            = 0xA0U,    /*!< Timeout state
                                                            Value is allowed for gState only */
    HAL_USART_IRDA_STATE_ERROR              = 0xE0U     /*!< Error
                                                            Value is allowed for gState only */
} HAL_USART_IrDA_StateTypeDef;

/**
  * @brief  USART Error Code Enum definition.
  */
typedef enum
{
    HAL_USART_IRDA_ERROR_NONE               = (uint32_t)0x00000000UL,   /*!< No error                   */

    HAL_USART_IRDA_ERROR_CONFIG             = (uint32_t)0x00000001UL,   /*!< Configure error            */

    HAL_USART_IRDA_ERROR_PARITY             = (uint32_t)0x00000002UL,   /*!< Parity error               */

    HAL_USART_IRDA_ERROR_TIMEOUT            = (uint32_t)0x00000004UL,   /*!< Wait time out              */

    HAL_USART_IRDA_ERROR_NE                 = (uint32_t)0x00000008UL,   /*!< Noise signal is received   */

    HAL_USART_IRDA_ERROR_FE                 = (uint32_t)0x00000010UL,   /*!< Frame error                */

    HAL_USART_IRDA_ERROR_ORE                = (uint32_t)0x00000020UL,   /*!< Receiving data overload    */

    HAL_USART_IRDA_ERROR_DMA                = (uint32_t)0x00000040UL,   /*!< DMA Error                  */

    HAL_USART_IRDA_ERROR_CALLBACKS          = (uint32_t)0x00000080UL,   /*!< CallBacks Error            */

} HAL_USART_IrDA_ErrorCodeTypeDef;

/**
  * @brief  USART Mode Enum definition.
  */
typedef enum
{
    USART_IRDA_MODE_NONE                    = (uint32_t)0x00000000U,

    USART_IRDA_MODE_TX                      = (uint32_t)(USART_CR1_TE),

    USART_IRDA_MODE_RX                      = (uint32_t)(USART_CR1_RE),

    USART_IRDA_MODE_TX_RX                   = (uint32_t)((USART_CR1_TE) | (USART_CR1_RE)),
} HAL_USART_IrDA_ModeTypeDef;

/**
  * @brief  USART Parity Enum definition.
  */
typedef enum
{
    USART_IRDA_PARITY_NONE                  = (uint32_t)0x00000000U,

    USART_IRDA_PARITY_EVEN                  = (uint32_t)(USART_CR1_PCE),

    USART_IRDA_PARITY_ODD                   = (uint32_t)((USART_CR1_PCE) | (USART_CR1_PS)),
} HAL_USART_IrDA_ParityTypeDef;

/**
  * @brief  USART WordLength Enum definition.
  */
typedef enum
{
    USART_IRDA_WORDLENGTH_8B                = (uint32_t)0x00000000U,

    USART_IRDA_WORDLENGTH_9B                = (uint32_t)(USART_CR1_M),
} HAL_USART_IrDA_WordLengthTypeDef;

/**
  * @brief  USART IrDA PowerMode Enum definition.
  */
typedef enum
{
    USART_IRDA_NORMAL_MODE                  = (uint32_t)0x00000000U,

    USART_IRDA_LOWPOWER_MODE                = ((uint32_t) USART_CR3_IRLP),

} HAL_USART_IrDA_PowerModeTypeDef;

/**
  * @brief  USART IrDA Prescaler Enum definition.
  */
typedef enum
{
    USART_IRDA_PRESCALER_SYSCLK_DIV0        = (uint32_t)0x00000000UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV2        = (uint32_t)0x00000001UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV4        = (uint32_t)0x00000002UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV6        = (uint32_t)0x00000003UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV8        = (uint32_t)0x00000004UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV10       = (uint32_t)0x00000005UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV12       = (uint32_t)0x00000006UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV14       = (uint32_t)0x00000007UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV16       = (uint32_t)0x00000008UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV18       = (uint32_t)0x00000009UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV20       = (uint32_t)0x0000000AUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV22       = (uint32_t)0x0000000BUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV24       = (uint32_t)0x0000000CUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV26       = (uint32_t)0x0000000DUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV28       = (uint32_t)0x0000000EUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV30       = (uint32_t)0x0000000FUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV32       = (uint32_t)0x00000010UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV34       = (uint32_t)0x00000011UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV36       = (uint32_t)0x00000012UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV38       = (uint32_t)0x00000013UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV40       = (uint32_t)0x00000014UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV42       = (uint32_t)0x00000015UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV44       = (uint32_t)0x00000016UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV46       = (uint32_t)0x00000017UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV48       = (uint32_t)0x00000018UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV50       = (uint32_t)0x00000019UL,
    USART_IRDA_PRESCALER_SYSCLK_DIV52       = (uint32_t)0x0000001AUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV54       = (uint32_t)0x0000001BUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV56       = (uint32_t)0x0000001CUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV58       = (uint32_t)0x0000001DUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV60       = (uint32_t)0x0000001EUL,
    USART_IRDA_PRESCALER_SYSCLK_DIV62       = (uint32_t)0x0000001FUL,
} HAL_USART_IrDA_PrescalerTypeDef;

/**
  * @brief  USART IrDA Init Structure definition.
  */
typedef struct
{
    uint32_t                            BaudRate;   /*!< This member configures the USART communication baud rate. */

    HAL_USART_IrDA_ModeTypeDef          Mode;       /*!< Specifies whether the Receive or Transmit mode is enabled or disabled. */

    HAL_USART_IrDA_ParityTypeDef        Parity;     /*!< Specifies the parity mode. */

    HAL_USART_IrDA_PowerModeTypeDef     PowerMode;  /*!< Specifies whether the Module power consumption Settings . */

    HAL_USART_IrDA_WordLengthTypeDef    WordLength; /*!< Specifies the number of data bits transmitted or received in a frame. */

    uint8_t                             Prescaler;  /*!< This member configures the UART_IrDA communication Prescaler. */

} USART_IrDA_InitTypeDef;

/**
  * @brief  USART IrDA handle Structure definition.
  */
typedef struct
{
    USART_TypeDef                           *Instance;          /*!< USART registers base address                               */

    USART_IrDA_InitTypeDef                  Init;               /*!< USART IrDA communication parameters                        */

    uint8_t                                 *pTxBuffPtr;        /*!< Pointer to USART IrDA Tx transfer Buffer                   */

    uint16_t                                TxXferSize;         /*!< USART IrDA Tx Transfer size                                */

    __IO uint16_t                           TxXferCount;        /*!< USART IrDA Tx Transfer Counter                             */

    uint8_t                                 *pRxBuffPtr;        /*!< Pointer to USART IrDA Rx transfer Buffer                   */

    uint16_t                                RxXferSize;         /*!< USART IrDA Rx Transfer size                                */

    __IO uint16_t                           RxXferCount;        /*!< USART IrDA Rx Transfer Counter                             */

    HAL_LockTypeDef                         Lock;               /*!< Locking object                                             */

    __IO HAL_USART_IrDA_StateTypeDef        gState;             /*!< USART IrDA state information related to Tx operations      */

    __IO HAL_USART_IrDA_StateTypeDef        RxState;            /*!< USART IrDA state information related to Rx operations      */

    __IO HAL_USART_IrDA_ErrorCodeTypeDef    ErrorCode;          /*!< USART IrDA Error code                                      */

    #if defined(HAL_DMA_MODULE_ENABLED)
    HAL_DMA_Handle_TypeDef                  *pHDma;             /*!< DMA Handle pointer                                         */
    #endif
} USART_IrDA_HandleTypeDef;



/** @brief  Gets the status of the input interrupt flag bit data.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @param  __FLAG__ specifies the flag to check.
  *             This parameter can be one of the following values:
  *             @arg USART_IRDA_FLAG_PE: Parity error flag.
  *             @arg USART_IRDA_FLAG_FE: Framing error flag.
  *             @arg USART_IRDA_FLAG_NE: Noise error flag.
  *             @arg USART_IRDA_FLAG_ORE: Overrun error flag.
  *             @arg USART_IRDA_FLAG_RXNE: Receive data register not empty flag.
  *             @arg USART_IRDA_FLAG_TC: Transmission complete flag.
  *             @arg USART_IRDA_FLAG_TXE: Transmit data register empty flag.
  * @retval  The state of __FLAG__ (RESET or SET)
  */
#define __HAL_USART_IRDA_GET_FLAG(__HANDLE__, __FLAG__)              ((((__HANDLE__)->Instance->SR) & (__FLAG__)) == (__FLAG__))


/** @brief  Clear the interrupt flag by writing 0 directly to the input bit.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @param  __FLAG__ specifies the flag to check.
  *             This parameter can be one of the following values:
  *             @arg USART_IRDA_FLAG_RXNE: Receive data register not empty flag.
  *             @arg USART_IRDA_FLAG_TC: Transmission complete flag.
  *             @arg USART_IRDA_FLAG_LBD: LIN break flag.
  *             @arg USART_IRDA_FLAG_CTS: CTS state changed flag.
  * @retval None
  */
#define __HAL_USART_IRDA_CLEAR_FLAG(__HANDLE__, __FLAG__)            (((__HANDLE__)->Instance->SR) = (~(__FLAG__)))


/** @brief  Use the software read/write sequence to clear some interrupt flag bits.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @retval None
  */
#define __HAL_USART_IRDA_SOFTSEQU_CLEAR_FLAG(__HANDLE__)        do{ __IO uint32_t regtmp = 0U; \
                                                                    regtmp = ((__HANDLE__)->Instance->SR); \
                                                                    regtmp = ((__HANDLE__)->Instance->DR); \
                                                                    UNUSED(regtmp); \
                                                                }while(0U)

/** @brief  Use the software read/write sequence to clear PE interrupt flag bits.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @retval None
  */
#define __HAL_USART_IRDA_CLEAR_PEFLAG(__HANDLE__)               __HAL_USART_IRDA_SOFTSEQU_CLEAR_FLAG(__HANDLE__)


/** @brief  Use the software read/write sequence to clear FE interrupt flag bits.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @retval None
  */
#define __HAL_USART_IRDA_CLEAR_FEFLAG(__HANDLE__)               __HAL_USART_IRDA_SOFTSEQU_CLEAR_FLAG(__HANDLE__)

/** @brief  Use the software read/write sequence to clear NE interrupt flag bits.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @retval None
  */
#define __HAL_USART_IRDA_CLEAR_NEFLAG(__HANDLE__)               __HAL_USART_IRDA_SOFTSEQU_CLEAR_FLAG(__HANDLE__)

/** @brief  Use the software read/write sequence to clear ORE interrupt flag bits.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @retval None
  */
#define __HAL_USART_IRDA_CLEAR_OREFLAG(__HANDLE__)              __HAL_USART_IRDA_SOFTSEQU_CLEAR_FLAG(__HANDLE__)


#ifndef __HAL_USART_ENABLE
/** @brief  Disable USART module.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @retval None
  */
#define __HAL_USART_DISABLE(__HANDLE__)                         CLEAR_BIT(((__HANDLE__)->Instance->CR1), USART_CR1_UE)

/** @brief  Enable USART module.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @retval None
  */
#define __HAL_USART_ENABLE(__HANDLE__)                          SET_BIT(((__HANDLE__)->Instance->CR1), USART_CR1_UE)
#endif  /* End of __HAL_USART_ENABLE*/

#ifndef __HAL_USART_IRDA_ENABLE
/** @brief  Diable USART IrDA mode.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @retval None
  */
#define __HAL_USART_IRDA_DISABLE(__HANDLE__)                    CLEAR_BIT(((__HANDLE__)->Instance->CR3), USART_CR3_IREN)

/** @brief  Enable USART IrDA mode.
  * @param  __HANDLE__ specifies the USART IrDA Handle.
  * @retval None
  */
#define __HAL_USART_IRDA_ENABLE(__HANDLE__)                     SET_BIT(((__HANDLE__)->Instance->CR3), USART_CR3_IREN)
#endif  /* End of __HAL_USART_IRDA_ENABLE */


/** @defgroup USART_Private_Macros USART Private Macros
  * @{
  */
#if defined(CONFIG_USE_ZB32L032)
//=======================   USART mode: IrDA mode  ============================//
#define IS_USART_IRDA_INSTANCE(INSTANCE)                    (((INSTANCE) == USART2) || ((INSTANCE) == USART3))

#endif  /* End of CONFIG_USE_ZB32L032 */
//=======================   USART IrDA Init Parameter   ============================//
#define IS_USART_IRDA_BAUDRATE(BAUDRATE)                    ((BAUDRATE) <= 115200U)

#define IS_USART_IRDA_MODE(MODE)                            (((MODE) == USART_IRDA_MODE_TX) || \
                                                             ((MODE) == USART_IRDA_MODE_RX) || \
                                                             ((MODE) == USART_IRDA_MODE_TX_RX))

#define IS_USART_IRDA_PARITY(PARITY)                        (((PARITY) == USART_IRDA_PARITY_NONE) || \
                                                             ((PARITY) == USART_IRDA_PARITY_EVEN) || \
                                                             ((PARITY) == USART_IRDA_PARITY_ODD))

#define IS_USART_IRDA_WORDLENGTH(WORDLENGTH)                (((WORDLENGTH) == USART_IRDA_WORDLENGTH_8B) || \
                                                            (((WORDLENGTH) == USART_IRDA_WORDLENGTH_9B)))

#define IS_USART_IRDA_POWERMODE(POWERMODE)                  (((POWERMODE) == USART_IRDA_NORMAL_MODE) || \
                                                             ((POWERMODE) == USART_IRDA_LOWPOWER_MODE))

#define IS_USART_IRDA_PRESCALER(PRESCALER)                  ((PRESCALER) <= 255U)

/**
  * @}
  */


/** @addtogroup USART_IRDA_Exported_Functions
  * @{
  */

/** @addtogroup USART_IRDA_Exported_Functions_Group1 Initialization and de-initialization functions
  * @{
  */
/* Initialization/de-initialization functions  **********************************/
HAL_StatusTypeDef HAL_USART_IRDA_Init(USART_IrDA_HandleTypeDef *pHIrda);
HAL_StatusTypeDef HAL_USART_IRDA_DeInit(USART_IrDA_HandleTypeDef *pHIrda);

void HAL_USART_IRDA_MspInit(USART_IrDA_HandleTypeDef *pHIrda);
void HAL_USART_IRDA_MspDeInit(USART_IrDA_HandleTypeDef *pHIrda);

/**
  * @}
  */

/** @addtogroup USART_IRDA_Exported_Functions_Group2
  * @{
  */
/* IO operation functions *******************************************************/
HAL_StatusTypeDef HAL_USART_IRDA_Transmit(USART_IrDA_HandleTypeDef *pHIrda, uint8_t *pData, uint16_t Size, uint32_t TimeOut);
HAL_StatusTypeDef HAL_USART_IRDA_Receive(USART_IrDA_HandleTypeDef *pHIrda, uint8_t *pData, uint16_t Size, uint32_t TimeOut);
HAL_StatusTypeDef HAL_USART_IRDA_TransmitReceive(USART_IrDA_HandleTypeDef *pHIrda, uint8_t *pTxData, uint16_t TxSize, uint8_t *pRxData, uint16_t RxSize, uint32_t TimeOut);

HAL_StatusTypeDef HAL_USART_IRDA_Transmit_IT(USART_IrDA_HandleTypeDef *pHIrda, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_USART_IRDA_Receive_IT(USART_IrDA_HandleTypeDef *pHIrda, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_USART_IRDA_TransmitReceive_IT(USART_IrDA_HandleTypeDef *pHIrda, uint8_t *pTxData, uint16_t TxSize, uint8_t *pRxData, uint16_t RxSize);

#if defined(HAL_DMA_MODULE_ENABLED)
HAL_StatusTypeDef HAL_USART_IRDA_Transmit_DMA(USART_IrDA_HandleTypeDef *pHIrda, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_USART_IRDA_Receive_DMA(USART_IrDA_HandleTypeDef *pHIrda, uint8_t *pData, uint16_t Size);
HAL_StatusTypeDef HAL_USART_IRDA_TransmitReceive_DMA(USART_IrDA_HandleTypeDef *pHIrda, uint8_t *pTxData, uint16_t TxSize, uint8_t *pRxData, uint16_t RxSize);

HAL_StatusTypeDef HAL_USART_IRDA_DMAPause(USART_IrDA_HandleTypeDef *pHIrda);
HAL_StatusTypeDef HAL_USART_IRDA_DMAResume(USART_IrDA_HandleTypeDef *pHIrda);
HAL_StatusTypeDef HAL_USART_IRDA_DMAStop(USART_IrDA_HandleTypeDef *pHIrda);

HAL_StatusTypeDef HAL_USART_IRDA_Transmit_DMAPause(USART_IrDA_HandleTypeDef *pHIrda);
HAL_StatusTypeDef HAL_USART_IRDA_Transmit_DMAResume(USART_IrDA_HandleTypeDef *pHIrda);
HAL_StatusTypeDef HAL_USART_IRDA_Transmit_DMAStop(USART_IrDA_HandleTypeDef *pHIrda);

HAL_StatusTypeDef HAL_USART_IRDA_Receive_DMAPause(USART_IrDA_HandleTypeDef *pHIrda);
HAL_StatusTypeDef HAL_USART_IRDA_Receive_DMAResume(USART_IrDA_HandleTypeDef *pHIrda);
HAL_StatusTypeDef HAL_USART_IRDA_Receive_DMAStop(USART_IrDA_HandleTypeDef *pHIrda);
#endif  /* End of HAL_DMA_MODULE_ENABLED */


void HAL_USART_IRDA_IRQHandler(USART_IrDA_HandleTypeDef *pHIrda);
void HAL_USART_IRDA_TxCpltCallback(USART_IrDA_HandleTypeDef *pHIrda);
void HAL_USART_IRDA_RxCpltCallback(USART_IrDA_HandleTypeDef *pHIrda);
void HAL_USART_IRDA_ErrorCallback(USART_IrDA_HandleTypeDef *pHIrda);
void HAL_USART_IRDA_AbortCpltCallback(USART_IrDA_HandleTypeDef *pHIrda);
void HAL_USART_IRDA_AbortTransmitCpltCallback(USART_IrDA_HandleTypeDef *pHIrda);
void HAL_USART_IRDA_AbortReceiveCpltCallback(USART_IrDA_HandleTypeDef *pHIrda);

/**
  * @}
  */

/** @addtogroup USART_IRDA_Exported_Functions_Group3
  * @{
  */
/* Peripheral State functions  ************************************************/
uint32_t HAL_USART_IRDA_GetState(USART_IrDA_HandleTypeDef *pHIrda);
uint32_t HAL_USART_IRDA_GetError(USART_IrDA_HandleTypeDef *pHIrda);

/**
  * @}
  */

/**
  * @}
  */


#ifdef __cplusplus
}
#endif  /* End of extern "C" {} */

#endif  /* End of __HAL_USART_IRDA_H */

